//
//  ZZFatherTableViewController.swift
//  网易微博
//
//  Created by gazyy1 on 16/6/25.
//  Copyright © 2016年 gazyy1. All rights reserved.
//

import UIKit

class ZZFatherTableViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = UIColor(red: 237/255.0, green: 237/255.0, blue: 237/255.0, alpha: 1.0)
    }

    var isLogin : Bool = false
    
    var fatherView : ZZFatherView?
    
    override func loadView() {
        
        if isLogin {
            super.loadView()
        }else{
            fatherView = ZZFatherView()
            
            view = fatherView
            fatherView?.buttonBlock = {[weak self] in
                self?.buttonClick()
            }
            
            setNavItem()
        }
    
    }
    
    private func setNavItem(){
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "buttonClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "buttonClick")
    }
    
    func buttonClick(){
        
        let modalVC = ZZLoginViewController()
        let nav = UINavigationController(rootViewController: modalVC)
        nav.view.tintColor = TemColor
        presentViewController(nav, animated: true, completion: nil)
    }
    

}
